package com.chf.job.service.impl;

import com.chf.job.dao.ReleaseVoMapper;
import com.chf.job.service.ReleaseVoService;
import com.chf.job.vo.ReleaseVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReleaseVoServiceImpl implements ReleaseVoService {
    @Autowired
    private ReleaseVoMapper releaseVoMapper;
    /**
     * 根据用户登录查看用户公司详细信息
     * @param email
     * @param id
     * @return
     */
    @Override
    public ReleaseVo getByEmailAndReleaseId(String email, Integer id) {
        return releaseVoMapper.selectByEmailAndReleaseId(email, id);
    }

    /**
     * 根据邮箱查询所有有效职位
     * @param email
     * @return
     */
    @Override
    public List<ReleaseVo> getByEmail(String email) {
        return releaseVoMapper.selectByEmail(email);
    }

    /**
     * 查询失效的职位
     * @param email
     * @return
     */
    @Override
    public List<ReleaseVo> getInvalidPositionByEmail(String email) {
        return releaseVoMapper.getInvalidPositionByEmail(email);
    }

    /**
     * 热门职位查询
     * @return
     */
    @Override
    public List<ReleaseVo> orderByClickNum() {
        return releaseVoMapper.orderByClickNum();
    }

    /**
     * 根据时间排序查询最新职位
     * @return
     */
    @Override
    public List<ReleaseVo> orderByUpdateTime() {
        return releaseVoMapper.orderByUpdateTime();
    }

    /**
     * 查看工作详细信息
     * @param releaseId
     * @return
     */
    @Override
    public ReleaseVo getByReleaseId(Integer releaseId) {
        return releaseVoMapper.getByReleaseId(releaseId);
    }

    /**
     * 根据类型搜索职位

     * @return
     */
    @Override
    public PageInfo<ReleaseVo> getBySearchTypeAndPositName(String search, String companySize, String experience, String xingZhi, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ReleaseVo> releaseVoList = releaseVoMapper.getBySearchTypeAndPositName(search, companySize, experience, xingZhi);
        PageInfo pageInfo = new PageInfo(releaseVoList);
        return pageInfo;
    }



}
